home *** CD-ROM | disk | FTP | other *** search
- Path: news.mindspring.com!usenet
- From: efried@mindspring.com (Eric Friedman)
- Newsgroups: comp.lang.c++
- Subject: Re: How to delete array of pointers?
- Date: Sat, 10 Feb 1996 07:31:09 GMT
- Organization: MindSpring Enterprises
- Message-ID: <4fh71r$3cu@brickbat.mindspring.com>
- References: <4fgvsu$5q4@eng_ser1.erg.cuhk.hk>
- NNTP-Posting-Host: efried.mindspring.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- ywleung@cs.cuhk.hk (Marty McFly) wrote:
-
- >If I write the following code in a function:
-
- > int** ptr;
- > ptr = new int*[1000];
-
- >Is this code means allocating 1000 integer pointers which is pointed by ptr?
- >And then somehow I assign integer variable to ptr[0], ptr[1], ... and so on.
- >So at the end of the function, how can I reclaim just those pointers? The key
- >point is that those integer variable assigned to the pointers should not be
- >deleted.
-
- There is no way to deallocate a subset of the array. You could copy
- the contents of the elements you want to keep to another array, or use
- the standard C functions mallaoc and realloc
- -------------------------------------------------------
- Eric Friedman Internet: efried@mindspring.com
-
-